package behavior.strategy.versionTwo;

import lombok.extern.slf4j.Slf4j;

import java.math.BigDecimal;

/**
 * @author huhaiqiang
 * @version V1.0
 * @description 打折收费子类
 * @date 2018/12/01 16:55
 */
@Slf4j
public class CashRebate extends CashSuper {

    /**
     * 折扣率
     */
    private BigDecimal moneyRebate;

    /**
     * 初始化时带入折扣率
     */
    CashRebate(String moneyRebate) {
        this.moneyRebate = new BigDecimal(moneyRebate);
    }

    @Override
    public BigDecimal acceptCash(BigDecimal money) {
        return money.multiply(moneyRebate);
    }
}
